/*
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

/* Author: Jorge Peña */

#ifndef XINERAMOID_H
#define XINERAMOID_H

#include <Plasma/Applet>
#include <Plasma/Svg>
#include <Plasma/DataEngine>
 
#include <KIcon>

class QSizeF;
class QLineEdit;
class Setup;

// Definimos nuestro applet de plasma
class PlasmaXineramoid : public Plasma::Applet
{
    Q_OBJECT
    public:
        // Constructor/Destructor básico
        PlasmaXineramoid(QObject *parent, const QVariantList &args);
        ~PlasmaXineramoid();

        // El procedimiento paintInterface dibuja el applet en la pantalla
        void paintInterface(QPainter *painter,
                const QStyleOptionGraphicsItem *option,
                const QRect& contentsRect);
        void init();
        //void mousePressEvent(QGraphicsSceneMouseEvent *event);
        void createConfigurationInterface(KConfigDialog *parent);
    signals:
        void monitorChanged();
    public slots:
        void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
        void sceneChanged();
        void textChanged();
    private slots:
        void loadConfig();
        void saveConfig();
        void scene_disconnect();
    private:
        Plasma::Svg m_svg;
        KIcon m_icon;
        int numScreens;
        QLineEdit *txtXRandrOptions;
        QString xrandrArgs;
        Setup *setup;
        int maxWidth;
        int maxHeight;
};
 
// Esta es la orden que enlaza el applet con el archivo .desktop
K_EXPORT_PLASMA_APPLET(xineramoid, PlasmaXineramoid)

#endif //< XINERAMOID_H
